<script setup>
import Step2 from './components/step-2.vue'
import { dict } from '@fast-crud/fast-crud'
import { useRoute } from 'vue-router'
import http from '@/http'
import { get } from 'lodash-es'

const projectDict = dict({
  label: 'name',
  value: 'id',
  data: []
})
const step2FormData = ref()

const route = useRoute()
const getDetail = async () => {
  const res = await http.post(`/task/find_id`, {
    taskID: route.query.id
  })
  if (res) {
    console.log(res)
    step2FormData.value = {
      region: get(res, 'order.server.projectName'),
      domain: get(res, 'order.server.tenant_id'),
      ak: '',
      sk: '',
      parameter: get(res, 'order.content')
    }
  }
}
onMounted(getDetail)
</script>

<template>
  <div class="w-10/12 mx-auto py-4">
    <a-breadcrumb>
      <a-breadcrumb-item>
        <router-link to="/">列表</router-link>
      </a-breadcrumb-item>
      <a-breadcrumb-item>详情</a-breadcrumb-item>
    </a-breadcrumb>
    <div class="bg-white p-4 my-4">
      <step2 :form-data="step2FormData" v-if="step2FormData" />
      <a-skeleton active v-else />
    </div>
    <div class="text-right">
      <a-button type="primary" @click="$router.push('/')">返回</a-button>
    </div>
  </div>
</template>

<style scoped lang="less"></style>
